<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div onmousedown="doDown(event)">hello world</div>

<script>
    function doDown(e) {
        console.log("doDown", e);
        document.addEventListener("mousemove", doMove);
        document.addEventListener("mouseup", doUp)

    }
    function doMove(e) {
        console.log("doMove", e)
    }
    function doUp(e) {
        console.log("doUp", e)
        document.removeEventListener("mousemove", doMove);
        document.removeEventListener("mouseup", doUp);
    }
</script>
</body>
</html>